ce5a0e4235b2a71b28edb1eaed9d1cdf34d97509,software/nosql/src/main/java/brooklyn/entity/nosql/redis/RedisStoreImpl.java,RedisStoreImpl,connectSensors,#,36

Before Change


        Optional<Location> location = Iterables.tryFind(getLocations(), Predicates.instanceOf(SshMachineLocation.class));
        if (!location.isPresent()) throw new IllegalStateException("Could not find SshMachineLocation in list of locations");
        SshMachineLocation machine = (SshMachineLocation) location.get();
        String statsCommand = getDriver().getRunDir() + "/bin/redis-cli info stats";

        sshFeed = SshFeed.builder()
                .entity(this)
                .machine(machine)
                .poll(new SshPollConfig<Integer>(UPTIME)
                        .command(getDriver().getRunDir() + "/bin/redis-cli info server")
                        .onException(Functions.constant(-1))
                        .onFailure(Functions.constant(-1))
                        .onSuccess(infoFunction("uptime_in_seconds")))
                .poll(new SshPollConfig<Integer>(TOTAL_CONNECTIONS_RECEIVED)
                        .command(statsCommand)
                        .onException(Functions.constant(-1))
                        .onFailure(Functions.constant(-1))
                        .onSuccess(infoFunction("total_connections_received")))
                .poll(new SshPollConfig<Integer>(TOTAL_COMMANDS_PROCESSED)
                        .command(statsCommand)
                        .onException(Functions.constant(-1))
                        .onFailure(Functions.constant(-1))
                        .onSuccess(infoFunction("total_commands_processed")))
                .poll(new SshPollConfig<Integer>(EXPIRED_KEYS)
                        .command(statsCommand)
                        .onException(Functions.constant(-1))
                        .onFailure(Functions.constant(-1))
                        .onSuccess(infoFunction("expired_keys")))
                .poll(new SshPollConfig<Integer>(EVICTED_KEYS)
                        .command(statsCommand)
                        .onException(Functions.constant(-1))
                        .onFailure(Functions.constant(-1))
                        .onSuccess(infoFunction("evicted_keys")))
                .poll(new SshPollConfig<Integer>(KEYSPACE_HITS)
                        .command(statsCommand)
                        .onException(Functions.constant(-1))
                        .onFailure(Functions.constant(-1))
                        .onSuccess(infoFunction("keyspace_hits")))
                .poll(new SshPollConfig<Integer>(KEYSPACE_MISSES)
                        .command(statsCommand)
                        .onException(Functions.constant(-1))
                        .onFailure(Functions.constant(-1))
                        .onSuccess(infoFunction("keyspace_misses")))
                .build();
    }

After Change


        Optional<Location> location = Iterables.tryFind(getLocations(), Predicates.instanceOf(SshMachineLocation.class));
        if (!location.isPresent()) throw new IllegalStateException("Could not find SshMachineLocation in list of locations");
        SshMachineLocation machine = (SshMachineLocation) location.get();
        String statsCommand = getDriver().getRunDir() + "/bin/redis-cli -p " + getRedisPort() + " info stats";

        sshFeed = SshFeed.builder()
                .entity(this)
                .machine(machine)
                .poll(new SshPollConfig<Integer>(UPTIME)
                        .command(getDriver().getRunDir() + "/bin/redis-cli -p " + getRedisPort() + " info server")
                        .onFailureOrException(Functions.constant(-1))
                        .onSuccess(infoFunction("uptime_in_seconds")))
                .poll(new SshPollConfig<Integer>(TOTAL_CONNECTIONS_RECEIVED)
                        .command(statsCommand)
                        .onFailureOrException(Functions.constant(-1))
                        .onSuccess(infoFunction("total_connections_received")))
                .poll(new SshPollConfig<Integer>(TOTAL_COMMANDS_PROCESSED)
                        .command(statsCommand)
                        .onFailureOrException(Functions.constant(-1))
                        .onSuccess(infoFunction("total_commands_processed")))
                .poll(new SshPollConfig<Integer>(EXPIRED_KEYS)
                        .command(statsCommand)
                        .onFailureOrException(Functions.constant(-1))
                        .onSuccess(infoFunction("expired_keys")))
                .poll(new SshPollConfig<Integer>(EVICTED_KEYS)
                        .command(statsCommand)
                        .onFailureOrException(Functions.constant(-1))
                        .onSuccess(infoFunction("evicted_keys")))
                .poll(new SshPollConfig<Integer>(KEYSPACE_HITS)
                        .command(statsCommand)
                        .onFailureOrException(Functions.constant(-1))
                        .onSuccess(infoFunction("keyspace_hits")))
                .poll(new SshPollConfig<Integer>(KEYSPACE_MISSES)
                        .command(statsCommand)
                        .onFailureOrException(Functions.constant(-1))
                        .onSuccess(infoFunction("keyspace_misses")))
                .build();
    }